////////////////////////////////////////////////////////////////////////////////
//
//	Original file Name: Sprite.java
//	Originating Author: JWhitefield
//	
//	Description: Instance of a single image sprite 
//
////////////////////////////////////////////////////////////////////////////////

package com.jjw.game.graphics;

import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Transparency;
import java.awt.image.BufferedImage;

import com.jjw.game.screen.Screen;

/**
 * Instance of a single image sprite
 * 
 * @author JWhitefield
 */
public class Sprite {

	//--------------------------------------------------------------------------
	//
	//Properties
	//
	//--------------------------------------------------------------------------
		
	//----------------------------------
	// Public
	//----------------------------------
	
	//----------------------------------
	//  Getters / Setters
	//----------------------------------

	/**
	 * Pixels which make up the sprite 
	 */
	public BufferedImage getImage() {
		return image;
	}

	private void setImage(BufferedImage image) {
		this.image = image;
	}

	
	/**
	 * The width of the sprite
	 */
	public int getWidth() {
		return width;
	}

	private void setWidth(int width) {
		this.width = width;
	}

	/**
	 * The height of the sprite
	 */
	public int getHeight() {
		return height;
	}

	private void setHeight(int height) {
		this.height = height;
	}
	
	/**
	 * Its position in the sprite sheet which row
	 */
	protected int getRow() {
		return this.row;
	}

	public void setRow(int row) {
		this.row = row;
	}

	/**
	 * Its position in the sprite sheet i.e. which column 
	 */
	protected int getColumn() {
		return this.column;
	}

	private void setColumn(int column) {
		this.column = column;
	}
	
	//----------------------------------
	// Private
	//----------------------------------	
		
	/**
	 * Its position in the sprite sheet i.e. which column 
	 */
	private int column;
	
	/**
	 * Its position in the sprite sheet which row
	 */
	private int row;
	
	/**
	 * Pixels which make up the sprite 
	 */
	private BufferedImage image;
	
	/**
	 * The width of the sprite
	 */
	private int width;
	
	/**
	 * The height of the sprite
	 */
	private int height;
	
	//--------------------------------------------------------------------------
	//
	//  Methods
	//
	//--------------------------------------------------------------------------
	
	//----------------------------------
	// Public
	//----------------------------------
		
	public Sprite( BufferedImage sprite, int column, int row ) {
		
		//Get the dimensions of the sprite
		this.setWidth( sprite.getWidth() );
		this.setHeight( sprite.getHeight() );
		
		//Set the column and row position 
		this.setColumn(column);
		this.setRow(row);
						
		//Create a compatible image from the one passed in and set it
		this.setImage( Screen.createCompatibleImage(sprite) );
	}
	
	//----------------------------------
	// Private
	//----------------------------------
		
	
	
	//----------------------------------
	// Overridden / Implemented
	//----------------------------------
}
